package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsHomeSubject;
import com.wuxiaofan.coupon.entity.custom.SmsHomeSubjectCustom;
import com.wuxiaofan.coupon.mapper.SmsHomeSubjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsHomeSubjectService {
    @Autowired
    private SmsHomeSubjectMapper smsHomeSubjectMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsHomeSubject findById(String id){
        return smsHomeSubjectMapper.selectById(id);
    }

    public SmsHomeSubjectCustom findCountByMap(Map paraMap){
        return smsHomeSubjectMapper.findCountByMap(paraMap);
    }

    public SmsHomeSubjectCustom findGroupByMap(Map paraMap){
        return smsHomeSubjectMapper.findGroupByMap(paraMap);
    }

    public List<SmsHomeSubjectCustom> findByMap(Map paraMap){
        return smsHomeSubjectMapper.findByMap(paraMap);
    }

    public Page<SmsHomeSubjectCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsHomeSubjectMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsHomeSubjectMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsHomeSubjectMapper.deleteById(id);
    }

    public SmsHomeSubject save(SmsHomeSubject smsHomeSubject){
        smsHomeSubject.setId(idgenerator.getId());
        smsHomeSubjectMapper.insert(smsHomeSubject);
        return smsHomeSubject;
    }

}
